/**
 * Created by IntelliJ IDEA.
 * User: martlenn
 * Date: 12-Dec-2006
 * Time: 12:06:14
 */
package edu.jhmi.tools.omssa_gui.omssa_readers;
/*
 * CVS information:
 *
 * $Revision$
 * $Date$
 */

/**
 * This class represents an OMSSA modification for the GUI.
 *
 * @author Lennart Martens
 * @version $Id$
 */
public class OMSSA_GUI_Modification {

    /**
     * This String holds the user-readable name for the modification.
     */
    private String name = null;

    /**
     * The OMSSA number for the modification. It is by this number that the
     * modification is known to the application.
     */
    private int number = -1;

    /**
     * This boolean is 'false' if the modification was defined by OMSSA
     * by default, and 'true' if the user defined it afterwards.
     */
    private boolean isUserModification = false;

    /**
     * This constructor takes all the necessary information to create a
     * modification instance.
     *
     * @param aName String with the user-readable name for the modification.
     * @param aNumber   int with the OMSSA number for the modification.
     * @param aUserModification  boolean to indicate whether this is a user-defined
     *                           modification.
     */
    public OMSSA_GUI_Modification(String aName, int aNumber, boolean aUserModification) {
        name = aName;
        number = aNumber;
        isUserModification = aUserModification;
    }

    /**
     * This constructor takes all the necessary information to create a
     * modification instance, save for the boolean to indicate user modification.
     * This is defaulted to 'false'.
     *
     * @param aName String with the user-readable name for the modification.
     * @param aNumber   int with the OMSSA number for the modification.
     */
    public OMSSA_GUI_Modification(String aName, int aNumber) {
        this(aName, aNumber, false);
    }

    public void setUserModification(boolean aUserModification) {
        isUserModification = aUserModification;
    }

    public boolean isUserModification() {
        return isUserModification;
    }

    public String getName() {
        return name;
    }

    public int getNumber() {
        return number;
    }

    public String toString() {
        StringBuffer result = new StringBuffer();

        result.append(name);
        if(isUserModification()) {
            result.append(" (user)");
        }

        return result.toString();
    }
}
